package com.xxx.study.designmodel.h生成器模式;

public class HtmlBuilder implements Builder{

    private String head;

    private String body;

    private String foot;

    @Override
    public Builder buildHead(String head) {
        this.head = "<html><head>" + head + "</html></head>";
        return this;
    }

    @Override
    public Builder buildBody(String body) {
        this.body = "<html><body>" + body + "</html></body>";
        return this;
    }

    @Override
    public Builder buildFoot(String foot) {
        this.foot = "<html><foot>" + foot + "</html></foot>";
        return this;
    }

    @Override
    public Product build() {
        return new HtmlProduct(this.head, this.body, this.foot);
    }

    public static Builder create() {
        return new HtmlBuilder();
    }
}
